package org.dromara.crawler.mongo.mongoservice.impl;

import com.mongoplus.conditions.query.LambdaQueryChainWrapper;
import com.mongoplus.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.dromara.crawler.mongo.mongodomain.CrawlerLogs;
import org.dromara.crawler.mongo.mongoservice.CrawlerLogsService;
import org.springframework.stereotype.Service;

/**
 * @author Shup
 * @date 2025/6/19 10:22
 */
@Service
@RequiredArgsConstructor
public class CrawlerLogServiceImpl extends ServiceImpl<CrawlerLogs> implements CrawlerLogsService {


    @Override
    public CrawlerLogs queryById(String id) {
        return this.getById(id);
    }

    @Override
    public CrawlerLogs getLogByTaskId(String crawlerTaskId) {
        LambdaQueryChainWrapper<CrawlerLogs> wrapper = this.lambdaQuery();
        wrapper.eq(CrawlerLogs::getTaskId, crawlerTaskId);
        return this.one(wrapper);
    }
}
